import numpy as np
import pandas as pd


#
# x = x1.values.tolist()
# print(x)

np.set_printoptions(threshold=np.inf)  # 不省略显示

dt = np.dtype(np.float_)
# names = ['height', 'mach', 'alpha', 'Ca', 'Cn', 'Cmy']
names = ['alpha', 'CL','CD','CDp','Cm','Top Xtr','Bot Xtr','Cpmin','Chinge','XCp']
names1 = ['alpha','Cd']
# 读取数据文件
dat1 = pd.read_csv('UIUC-Cd', skiprows=[0], names=names1, header=None, sep='\s+',
                   usecols=[0, 1])
dat2 = pd.read_csv('../NACA6409-CL/xfl5-NACA-6409.txt', skiprows=[0], names=names, header=None, sep='\s+',
                   usecols=[0, 1, 2, 4, 5, 6, 7, 8, 9])
dat3 = pd.read_csv('UIUC-add-Cd.txt', skiprows=[0], names=names1, header=None, sep='\s+',
                   usecols=[0, 1])

x0 = np.mat(np.array(dat2)[:, 0])

x0 = x0.reshape(x0.shape[1],1)

x1 = np.array(x0)[::2,0]
x2 = np.array(x0)[1::2,0]

y = np.array(dat2)[:,2]
y0 = np.array(dat2)[::2,2]
y1 = np.array(dat2)[1::2,2]

print(x0)
print(x1)
print(x2)
print(y)
print(y0)
print(y1)

# =================================================


# x0 = np.mat(np.array(dat3)[:, 0])
# x0 = x0.reshape(x0.shape[1],1)
# print(x0)
#
# x1 = np.array(x0)[::2,0]
# x2 = np.array(x0)[1::2,0]
# print(x1)
# print(x2)
#
# y0 = np.array(dat3)[::2,1]
# y1 = np.array(dat3)[1::2,1]
# print(y0)
# print(y1)